﻿@model IEnumerable<ProjetoModeloDDD.MVC.ViewsModels.ProdutoViewModel>

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table class="table">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.Nome)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Valor)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Disponivel)
        </th>
        <th>
            @Html.DisplayName("Cliente")
        </th>
        <th></th>
    </tr>

    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Nome)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Valor)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Disponivel)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Cliente.Nome)
            </td>
            <td>
                @Html.ActionLink("Edit", "Edit", new { id = item.ProdutoId }) |
                @Html.ActionLink("Details", "Details", new { id = item.ProdutoId }) |
                @Html.ActionLink("Delete", "Delete", new { id = item.ProdutoId })
            </td>
        </tr>
    }
</table>